<html>
<head>
  <meta HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=ISO-8859-1">
  <title>Contents.m</title>
<link rel="stylesheet" type="text/css" href="../stpr.css">
</head>
<body>
<table  border=0 width="100%" cellpadding=0 cellspacing=0><tr valign="baseline">
<td valign="baseline" class="function"><b class="function">KNNCLASS</b>
<td valign="baseline" align="right" class="function"><a href="../misc/index.html" target="mdsdir"><img border = 0 src="../up.gif"></a></table>
  <p><b>k-Nearest Neighbours classifier.</b></p>
  <hr>
<div class='code'><code>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Synopsis:</span></span><br>
<span class=help>&nbsp;&nbsp;y&nbsp;=&nbsp;knnclass(X,model)</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Description:</span></span><br>
<span class=help>&nbsp;&nbsp;The&nbsp;input&nbsp;feature&nbsp;vectors&nbsp;X&nbsp;are&nbsp;classified&nbsp;using&nbsp;the&nbsp;K-NN</span><br>
<span class=help>&nbsp;&nbsp;rule&nbsp;defined&nbsp;by&nbsp;the&nbsp;input&nbsp;model.</span><br>
<span class=help>&nbsp;</span><br>
<span class=help>&nbsp;<span class=help_field>Input:</span></span><br>
<span class=help>&nbsp;&nbsp;X&nbsp;[dim&nbsp;x&nbsp;num_data]&nbsp;Data&nbsp;to&nbsp;be&nbsp;classified.</span><br>
<span class=help>&nbsp;&nbsp;model&nbsp;[struct]&nbsp;Model&nbsp;of&nbsp;K-NN&nbsp;classfier:</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;.X&nbsp;[dim&nbsp;x&nbsp;num_prototypes]&nbsp;Prototypes.</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;.y&nbsp;[1&nbsp;x&nbsp;num_prototypes]&nbsp;Labels&nbsp;of&nbsp;prototypes.</span><br>
<span class=help>&nbsp;&nbsp;&nbsp;.K&nbsp;[1x1]&nbsp;Number&nbsp;of&nbsp;used&nbsp;nearest-neighbours.</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Output:</span></span><br>
<span class=help>&nbsp;&nbsp;y&nbsp;[1&nbsp;x&nbsp;num_data]&nbsp;Classified&nbsp;labels&nbsp;of&nbsp;testing&nbsp;data.</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=help_field>Example:</span></span><br>
<span class=help>&nbsp;&nbsp;trn&nbsp;=&nbsp;load('riply_trn');</span><br>
<span class=help>&nbsp;&nbsp;tst&nbsp;=&nbsp;load('riply_tst');</span><br>
<span class=help>&nbsp;&nbsp;ypred&nbsp;=&nbsp;knnclass(tst.X,knnrule(trn,5));</span><br>
<span class=help>&nbsp;&nbsp;cerror(&nbsp;ypred,&nbsp;tst.y&nbsp;)</span><br>
<span class=help></span><br>
<span class=help>&nbsp;<span class=also_field>See also </span><span class=also></span><br>
<span class=help><span class=also>&nbsp;&nbsp;<a href = "../misc/knnrule.html" target="mdsbody">KNNRULE</a>.</span><br>
<span class=help></span><br>
</code></div>
  <hr>
  <b>Source:</b> <a href= "../misc/list/knnclass.html">knnclass.m</a>
  <p><b class="info_field">(c) </b> Statistical Pattern Recognition Toolbox, (C) 1999-2003,<br>
 Written by Vojtech Franc and Vaclav Hlavac,<br>
 <a href="http://www.cvut.cz">Czech Technical University Prague</a>,<br>
 <a href="http://www.feld.cvut.cz">Faculty of Electrical engineering</a>,<br>
 <a href="http://cmp.felk.cvut.cz">Center for Machine Perception</a><br>

  <p><b class="info_field">Modifications: </b> <br>
 19-may-2003, VF<br>
 18-sep-2002, V.Franc<br>

</body>
</html>
